package com.itheima.d1_collection_set;

import java.util.HashSet;

/*
     目标：自定义的类型的对象，比如两个内容一样的学生对象，如果让HashSet集合能够去重复！
 */
public class SetTest3 {
    public static void main(String[] args) {
        HashSet<Student> st = new HashSet<>();
        st.add(new Student("zhangsan","20"));
        st.add(new Student("lisi","10"));
        st.add(new Student("wangwu","15"));
        st.add(new Student("zhangsan","11"));
        st.add(new Student("xiaoer","30"));
        for (Student s : st) {
            System.out.println(s.getName()+" "+s.getSex());
        }

    }
}
